<template lang="">
    <div>
        <el-table :data="dataList" stripe style="width: 100%" border>
            <el-table-column prop="audit_name" label="审核名称"> </el-table-column>
            <el-table-column label="状态">
                <template slot-scope="scope">
                    <el-switch v-model="scope.row.status" active-color="#13ce66" inactive-color="#ff4949" :active-value="1"
             :inactive-value="2"  @change='switch_change(scope.row.status,scope.row.id)'>
           </el-switch>
                </template>
             </el-table-column>
        </el-table>
    </div>
</template>
<script>
import { getOrderAuditList ,setOrderAuditStatus } from '@/api/product'
export default {
    data() {
        return {
            dataList:[]
        }
    },
    mounted() {
        this.getlist()
    },
    methods:{
        getlist(){
            getOrderAuditList().then(res=>{
                if(res.code==200){
                    this.dataList = res.data.data
                }
            })
        },
         switch_change(val, id) {
            let prms = {
              id,
              status: val
            }
            setOrderAuditStatus(prms).then(res => {
              console.log(res)
              if (res.code == 200) {
               this.$message({
                  type:'success',
                  message: '操作成功'
                })
                this.getlist()
              }
            });
          }
    }
}
</script>
<style lang="">
    
</style>